<template>
  <div class="app-container">
    <el-row :gutter="20">
      <splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
        <!--新闻资讯数据-->
        <pane size="84">
          <el-col>
            <!--            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
                          <el-form-item label="新闻标题" prop="title">
                            <el-input v-model="queryParams.title" placeholder="请输入新闻标题" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
                          </el-form-item>
                          <el-form-item label="发布状态" prop="status">
                            <el-select v-model="queryParams.status" placeholder="发布状态" clearable style="width: 240px">
                              <el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
                            </el-select>
                          </el-form-item>
                          <el-form-item>
                            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
                          </el-form-item>
                        </el-form>-->

            <el-table v-loading="loading" :data="articleList" @selection-change="handleSelectionChange">
              <el-table-column type="selection" width="50" align="center" :show-overflow-tooltip="true"/>
              <el-table-column label="收款人" align="center" key="nickname" prop="nickname" width="200"
                               :show-overflow-tooltip="true"/>
              <el-table-column label="微信openId" align="center" key="openId" prop="openId" width="400"
                               :show-overflow-tooltip="true"/>
              <el-table-column label="转账金额(元)" prop="amount">
                <template #default="scope">
                  {{ (scope.row.amount / 100).toFixed(2) }}
                </template>
              </el-table-column>
              <el-table-column label="微信流水号" prop="transferBillNo" width="400"/>
              <el-table-column label="转账时间" align="center" prop="createTime">
                <template slot-scope="scope">
                  <span>{{ parseTime(scope.row.createTime) }}</span>
                </template>
              </el-table-column>
            </el-table>

            <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
                        :limit.sync="queryParams.pageSize" @pagination="getList"/>
          </el-col>
        </pane>
      </splitpanes>
    </el-row>
  </div>
</template>


<script>
import {listTransfer} from "@/api/system/transfer"
import {getSite, getToken} from "@/utils/auth"
import {Splitpanes, Pane} from "splitpanes"
import "splitpanes/dist/splitpanes.css"

export default {
  name: "WxUserList",
  dicts: ['sys_normal_disable', 'sys_user_sex'],
  components: {Splitpanes, Pane},
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 新闻资讯表格数据
      articleList: null,
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 表单参数
      form: {},
      // 查询参数
      queryParams: {
        tenantId: getSite(),
        articleType: 1,
        pageNum: 1,
        pageSize: 10,
        title: undefined,
        status: undefined
      },
      // 查询参数
      editQueryParams: {
        tenantId: getSite()
      },
      // 上传的图片服务器地址
      uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload",
      // 上传图片个数
      number: 0,
      headers: {
        Authorization: "Bearer " + getToken(),
      },
      fileList: [],   //新闻资讯图
      imageList: [],  //列表缩略图
      attachmentList: [], //附件上传
      uploadList: [], //临时上传列表
      dialogVisible: false,
      dialogImageUrl: "",
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true
      listTransfer(this.queryParams).then(response => {
          this.articleList = response.rows
          this.total = response.total
          this.loading = false
        }
      )
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        articleId: undefined,
        cateId: undefined,
        title: undefined,
        status: "0",
        content: undefined,
      }
      this.resetForm("form")
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = []
      this.resetForm("queryForm")
      this.queryParams.deptId = undefined
      this.$refs.tree.setCurrentKey(null)
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.userId)
      this.single = selection.length != 1
      this.multiple = !selection.length
    },
  }
}
</script>
